
//
//  DownloadTableViewCell.m
//  yonghu
//
//  Created by 浪尖渝力 on 2018/2/25.
//  Copyright © 2018年 com.DJS. All rights reserved.
//

#import "DownloadTableViewCell.h"
#import "ChaKanXiaViewController.h"
@implementation DownloadTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)creatView{
    
    UIImageView *imageView=[UIImageView new];
    [self.contentView addSubview:imageView];
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.width.mas_equalTo(45);
        make.height.mas_equalTo(60);
        make.left.mas_equalTo(15);
    }];
    imageView.image=[UIImage imageNamed:@"我的下载"];
    
    UILabel *label=[UILabel new];
    [self.contentView  addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(imageView.mas_right).mas_equalTo(15);
        make.top.mas_equalTo(imageView);
    }];
    label.text=[_dic objectForKey:@"title"];
    label.font=[UIFont systemFontOfSize:20];
    label.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *label2=[UILabel new];
    [self.contentView  addSubview:label2];
    [label2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(label);
        make.bottom.mas_equalTo(imageView);
    }];
    NSString *sizeKb=[_dic objectForKey:@"size"];
    NSString *time=[_dic objectForKey:@"time"];
    
    label2.text=[NSString stringWithFormat:@"%@\t%@",sizeKb,time];
    label2.font=[UIFont systemFontOfSize:15];
    label2.textColor=ColorWithRGB(149, 149, 149);

    
    UIButton *btn=[UIButton new];
    [self.contentView  addSubview:btn];
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-20);
        make.height.mas_equalTo(35);
        make.width.mas_equalTo(70);
        make.centerY.mas_equalTo(0);
    }];
    btn.layer.cornerRadius=4;
    btn.layer.borderWidth=1;
    btn.layer.borderColor=ColorWithRGB(149, 149, 149).CGColor;
    [btn setTitle:@"打开" forState:0];
    [btn setTitleColor:ColorWithRGB(149, 149, 149) forState:0];
    [btn addTarget:self action:@selector(pushToChaKan:) forControlEvents:UIControlEventTouchUpInside];
    
}
-(IBAction)pushToChaKan:(id)sender{
    ChaKanXiaViewController *chaKan=[[ChaKanXiaViewController alloc] init];
    chaKan.file=[_dic objectForKey:@"filePath"];
    [ZQTools pushNextViewController:self.viewController andRootController:chaKan];
}
@end
